package com.hoas.quickstart.threads.chapter02.chapter02_1_4;


public class Run {

    public static void main(String[] args) {

        System.out.println("两个线程同时操作同一个对象的不同方法，两个方法都synchronized标记后，一个线程需要等待另一个线程的该方法执行完成后才能够继续执行，否则出于阻塞状态");

        MyObject object = new MyObject();
        ThreadA athread = new ThreadA(object);
        athread.setName("A");

        ThreadB bthread = new ThreadB(object);
        bthread.setName("B");

        athread.start();
        bthread.start();


    }

}
